//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;
using OpenLS.Drawing.Serialization;

namespace OpenLS.Drawing
{
    public class Scene3D : IOfficeXmlSerializable
    {
        private Camera camera;

        private LightRig lightRig;
        private Backdrop backDrop;
        private OfficeArtExtensionList extLst;

        public Camera Camera
        {
            get { return camera; }
            set { camera = value; }
        }

        public LightRig LightRig
        {
            get { return lightRig; }
            set { lightRig = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.ReadAndSwitch(xmlName, DrawingConstants.DrawingNamespaceUri, false))
            {
                c.PassAttributes();
                Camera = c.ReadElement<Camera>();
                lightRig = c.ReadElement<LightRig>();
                this.backDrop = c.ReadOptionalElement<Backdrop>(Backdrop.xmlName);
                this.extLst = c.ReadOptionalElement<OfficeArtExtensionList>(OfficeArtExtensionList.xmlName);
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.WriteAndSwitch(xmlName, DrawingConstants.DrawingNamespace))
            {
                c.WriteElement(Camera);
                c.WriteElement(LightRig);
                c.WriteOptionalElement(backDrop);
                c.WriteOptionalElement(extLst);
            }
        }

        internal const string xmlName = "scene3d";


        #endregion
    }
}